﻿@model ProductEmailAFriendModel
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_ColumnsOne";

    //title
    pagebuilder.AddTitleParts(Model.ProductName);
    pagebuilder.AddTitleParts(T("PageTitle.ProductEmailAFriend").Text);
}
<div class="page email-a-friend-page">
    <h1 class="h2 text-xs-center generalTitle">@T("Products.EmailAFriend.Title")</h1>
    <b-card>
        <template v-slot:header>
            <h4 class="mb-0"><b-link href="@Url.RouteUrl("Product", new { SeName = Model.ProductSeName })" class="product">@Model.ProductName</b-link></h4>
        </template>
            @if (Model.SuccessfullySent)
            {
                <div class="alert alert-info my-3 text-center result">
                    @Model.Result
                </div>
            }
            else
            {
                <form asp-route="ProductEmailAFriend" method="post" v-on:submit.prevent="validateBeforeSubmitParam($event, 'send-email')">
                    <div asp-validation-summary="ModelOnly" class="message-error"></div>
                    <div class="form-fields">
                        <div class="form-group">
                            <label asp-for="FriendEmail" class="col-form-label">@T("Products.EmailAFriend.FriendEmail"):</label>
                            <input asp-for="FriendEmail" class="form-control friend-email"
                                   v-validate="'required|email'" placeholder="@T("Products.EmailAFriend.FriendEmail.Hint")" />
                            <span class="field-validation-error">{{veeErrors.first('FriendEmail')}}</span>
                            <span asp-validation-for="FriendEmail"></span>
                        </div>
                        <div class="form-group">
                            <label asp-for="YourEmailAddress" class="col-form-label">@T("Products.EmailAFriend.YourEmailAddress"):</label>
                            <input asp-for="YourEmailAddress" class="form-control your-email" v-validate="'required|email'" placeholder="@T("Products.EmailAFriend.YourEmailAddress.Hint")" />
                            <span class="field-validation-error">{{veeErrors.first('YourEmailAddress')}}</span>
                            <span asp-validation-for="YourEmailAddress"></span>
                        </div>
                        <div class="form-group">
                            <label asp-for="PersonalMessage" class="col-form-label">@T("Products.EmailAFriend.PersonalMessage"):</label>
                            <textarea asp-for="PersonalMessage" class="form-control your-email" placeholder="@T("Products.EmailAFriend.PersonalMessage.Hint")" v-validate="'required'"></textarea>
                            <span class="field-validation-error">{{veeErrors.first('PersonalMessage')}}</span>
                            <span asp-validation-for="PersonalMessage"></span>
                        </div>
                        @if (Model.DisplayCaptcha)
                        {
                            <div class="captcha-box">
                                <captcha />
                            </div>
                        }
                    </div>
                    <div class="btn-group">
                        <input type="submit" name="send-email" class="btn btn-info send-email-a-friend-button" value="@T("Products.EmailAFriend.Button")" />
                    </div>
                </form>
            }
    </b-card>
</div>